import request from '@/utils/http'
import { BaseResponse } from '@/types/api'
//用户标签列表
export function userLabelList(data: object) {
  return request.get<BaseResponse>({
    url: 'dsMemberTags/page',
    params: data
  })
}
// 用户标签修改/新增
export function AddUserLabel(data: object) {
  return request.post<BaseResponse>({
    url: 'dsMemberTags',
    data
  })
}
// 用户标签删除
export function DelUserLabel(ids: number) {
  return request.del<BaseResponse>({
    url: `dsMemberTags/${ids}`
  })
}
// 用户分组列表
export function userGrouping(data: object) {
  return request.get<BaseResponse>({
    url: `dsMemberGroup/page`,
    params: data
  })
}
// 用户分组修改/新增
export function AddUserGrouping(data: object) {
  return request.post<BaseResponse>({
    url: 'dsMemberGroup',
    data
  })
}
// 用户分组删除
export function DelUserGrouping(ids: number) {
  return request.del<BaseResponse>({
    url: `dsMemberGroup/${ids}`
  })
}
// 驾校报名点下拉列表
export function SignUpList() {
  return request.get<BaseResponse>({
    url: `ds-registration-site/options`
  })
}
// 招生员下拉列表
export function enrollStudents() {
  return request.get<BaseResponse>({
    url: `recruitingSpecialist/options`
  })
}
// 车型下拉列表
export function cardsType() {
  return request.get<BaseResponse>({
    url: `ds-car-model/options`
  })
}
// 班型下拉列表
export function classType() {
  return request.get<BaseResponse>({
    url: `ds-store-package/options`
  })
}
// 教练员下拉列表
export function coachData() {
  return request.get<BaseResponse>({
    url: `Coach/options`
  })
}
// 用户分组下拉列表
export function userGroup() {
  return request.get<BaseResponse>({
    url: `dsMemberGroup/options`
  })
}
// 用户标签下拉列表
export function labelGroup() {
  return request.get<BaseResponse>({
    url: `dsMemberTags/options`
  })
}
// 用户列表
export function userList(data: object) {
  return request.get<BaseResponse>({
    url: `dsMember/page`,
    params: data
  })
}
// 新增用户/学员
export function AddUsers(data: object) {
  return request.post<BaseResponse>({
    url: `dsMemberRecord/save`,
    data
  })
}
// 编辑用户/学员
export function EditUsers(data: object) {
  return request.put<BaseResponse>({
    url: `dsMemberRecord/update`,
    data
  })
}
// 学员档案
export function studentsFiles(data: object) {
  return request.get<BaseResponse>({
    url: `dsMemberRecord/page`,
    params: data
  })
}
// 会员卡下拉
export function vipType() {
  return request.get<BaseResponse>({
    url: `dsClubCard/options`
  })
}
// 会员卡权益
export function vipEquity(data: object) {
  return request.get<BaseResponse>({
    url: `dsClubCard/page`,
    params: data
  })
}
// 会员卡新增
export function addVip(data: object) {
  return request.post<BaseResponse>({
    url: `dsClubCard/save`,
    data
  })
}
// 会员卡编辑
export function editVip(data: object) {
  return request.put<BaseResponse>({
    url: `dsClubCard/update`,
    data
  })
}
// 会员卡删除
export function delVip(ids: string) {
  return request.get<BaseResponse>({
    url: `dsClubCard/${ids}`
  })
}
// 会员卡题目类型下拉
export function questionType(data: object) {
  return request.get<BaseResponse>({
    url: `ds-question-group/tree`,
    params: data
  })
}
// 兑换码列表
export function codeList(data: object) {
  return request.get<BaseResponse>({
    url: `cdKey/page`,
    params: data
  })
}
// 新增兑换码
export function AddCodeList(data: object) {
  return request.post<BaseResponse>({
    url: `cdKey/save`,
    data
  })
}
// 编辑兑换码
export function EditCodeList(data: object) {
  return request.post<BaseResponse>({
    url: `cdKey/update`,
    data
  })
}
// 修改兑换码状态
export function EditState(data: object) {
  return request.get<BaseResponse>({
    url: `cdKey/updateState`,
    params: data
  })
}
// 删除兑换码
export function DelCodeList(id: number) {
  return request.del<BaseResponse>({
    url: `cdKey/${id}`
  })
}
// 用户列表编辑
export function EditUserList(data: object) {
  return request.post<BaseResponse>({
    url: `dsMember`,
    data
  })
}
// 用户信息统计
export function userStatistics() {
  return request.get<BaseResponse>({
    url: `dsMember/statistics`
  })
}
// 学员信息统计
export function studentStatistics() {
  return request.get<BaseResponse>({
    url: `dsMemberRecord/statistics`
  })
}
// 用户详情
export function userDetails(id: number) {
  return request.get<BaseResponse>({
    url: `/dsMember/${id}`
  })
}
// 用户详情重置密码
export function resetPassword(memberId: number, data: string) {
  return request.put<BaseResponse>({
    url: `dsMember/${memberId}/password/reset`,
    data
  })
}
//兑换码详情
export function cdKeyDetails(data: object) {
  return request.get<BaseResponse>({
    url: `cdKeyDetails/page`,
    params: data
  })
}
//作废兑换码
export function DelCdKeyDetails(id: number) {
  return request.get<BaseResponse>({
    url: `cdKeyDetails/${id}`
  })
}
//会员、报名订单
export function vipOrders(data: object) {
  return request.get<BaseResponse>({
    url: `dsOrders/page`,
    params: data
  })
}

// 新增考试时间
export function addExamDate<T = any>(data: T[], examTime: string) {
  return request.post<BaseResponse>({
    url: `dsMemberRecord/addExamTime`,
    data,
    params: { examTime }
  })
}
// 用户开通会员列表
export function userOpenVip(data: object) {
  return request.get<BaseResponse>({
    url: `dsMember/memberVips`,
    params: data
  })
}
// 会员列表
export function vipListData(data: object) {
  return request.get<BaseResponse>({
    url: `dsMember/vipList`,
    params: data
  })
}

// 获取当前用户练习记录
export function practiceRecord(data: object) {
  return request.get<BaseResponse>({
    url: `dsMember/learningRecord`,
    params: data
  })
}

export function delMember(id: string) {
  return request.del<BaseResponse>({
    url: `dsMember/del/${id}`
  })
}

